#!ipxe

# Devuan Operating System
# http://www.devuan.org

goto ${menu}

:devuan
set os Devuan
set os_arch ${arch}
iseq ${os_arch} x86_64 && set os_arch amd64 ||
clear devuan_version
clear older_release
menu ${os} - ${os_arch}
item --gap Latest Releases
{% for item in releases.devuan.versions.stable %}
item {{ item.code_name }} ${space} ${os} {{ item.name }}
{% endfor %}
item --gap Testing Releases
{% for item in releases.devuan.versions.testing %}
item {{ item.code_name }} ${space} ${os} {{ item.name }}
{% endfor %}
choose devuan_version || goto devuan_exit
goto mirrorcfg

:mirrorcfg
set mirrorcfg mirror/suite=${devuan_version}
set dir ${devuan_base_dir}/dists/${devuan_version}/main/installer-${os_arch}/current/images/netboot/
goto devuan_boot_type

:devuan_boot_type
menu ${os} [${devuan_version}] Installer
item --gap Install types
item text ${space} Text Based Install
item graphical ${space} Graphical Based Install
item rescue ${space} Rescue Mode
item expert ${space} Expert Install
item preseed ${space} Specify preseed url...
choose --default ${type} type || goto devuan

echo ${cls}
goto devuan_${type}

:devuan_rescue
set install_params rescue/enable=true
goto devuan_text

:devuan_expert
set install_params priority=low
goto devuan_text

:devuan_preseed
echo -n Specify preseed URL for ${os} ${devuan_version}: && read preseedurl
set install_params auto=true priority=critical preseed/url=${preseedurl}
goto devuan_text

:devuan_text
set dir ${dir}debian-installer/${os_arch}
goto devuan_boot

:devuan_graphical
set dir ${dir}gtk/debian-installer/${os_arch}
set install_params vga=788
goto devuan_boot

:devuan_boot
imgfree
echo Boot parameters: ${install_params} -- quiet ${params}
kernel ${devuan_mirror}/${dir}/linux ${install_params} ${mirrorcfg} -- quiet ${params} {{ kernel_params }}
initrd ${devuan_mirror}/${dir}/initrd.gz
echo
echo MD5sums:
md5sum linux initrd.gz
boot

:devuan_exit
clear menu
exit 0
